package com.bawei.mmvvpp.vv;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.bawei.mmvvpp.pp.KotlinPretenter;

/**
 * create by ertu
 * create on 2021/7/31
 * description
 */
public abstract class KotlinBaseFragment<P extends KotlinPretenter> extends Fragment implements KotlinFragment,KotlinView {
    protected P preff;
    private View view;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return view = inflater.inflate(kaotlinLayout(),container,false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        kaotinitView();
        kaotinitDate();
    }

    @Override
    public void showkotlin() {

    }

    @Override
    public void haidkotlin() {

    }

    @Override
    public void tostkotlin() {

    }

    @Override
    public <T extends View> T findkotlinid(int id) {
        return view.findViewById(id);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (preff!=null)
        {
            preff=null;
            preff.kotlinpretenterds();
        }
    }
}
